<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="d1">
        默认
    </div>

    <input type="checkbox" name="hobby" value="篮球" id="">篮球
    <input type="checkbox" name="hobby" value="zq" id="">足球
    <input type="checkbox" name="hobby" value="tq" id="">台球




    <input type="button" value="内容1" onclick="content1()">
    <input type="button" value="内容2" onclick="content2()">
    <script>
        function content1() {
            let ary = document.getElementsByName("hobby");
            debugger
        }

        function content2() {
            let ary = document.getElementsByTagName("input")
            console.log(ary.length)
            debugger

        }
    </script>
</body>

</html>